import { useEffect } from "react";
import { useForm } from "../../framework/common/context/metadata-context";
import watermark, { removeWatermark } from "../../framework/common/utils/watermark";

export default function (containerClass) {
  const form = useForm();
  useEffect(() => {
    //开启水印时，生成水印
    if (form.data.watermark.isShow == "1") {
      watermark(form.data.watermark.content, containerClass, form.data.form?.form_meta_data?.groups?.length - 3);
    }
    return () => {
      removeWatermark(containerClass);
    };
  }, []);
}
